package br.mikhas.container.factory;

import br.mikhas.container.config.BeanDefinition;

/**
 * The resource post processor is used to process a bean after it's
 * instantiation and initialization.
 * <p>
 * It may applies new configuration, proxing or other desired features to the
 * resource.
 * 
 * @author Mikhail Domanoski
 * 
 */
public interface BeanPostProcessor extends BeanFactoryAware {
	/**
	 * Post process the bean and returns a processed version of it.
	 * 
	 * @param definition
	 *            The resource definition
	 * @param resource
	 *            The resource instance
	 */
	public Object processBean(BeanDefinition definition, Object resource);

	/**
	 * Checks if the processor is able to process a resource.
	 * 
	 * @param definition
	 *            The resource definition
	 * @return <code>true</code> if it's able to process this resource
	 */
	public boolean mayProcess(BeanDefinition definition);
}
